/*
 * DroneCommand.h
 *
 * Encapsulates movement command parameters for the Drone.
 *
 *  Created on: 16.07.2012
 *      Author: seb
 */

#ifndef DRONECOMMAND_H_
#define DRONECOMMAND_H_

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <boost/lexical_cast.hpp>

using namespace std;

#define DRONE_SPECIAL_COMMAND_NONE 		0
#define DRONE_SPECIAL_COMMAND_START 	1
#define DRONE_SPECIAL_COMMAND_LAND		2
#define DRONE_SPECIAL_COMMAND_HOVER		3
#define DRONE_SPECIAL_COMMAND_EMERGENCY	4

// delete later, only for tests until to string and from string are implemented
#define DRONE_NET_NONE					"NONE"
#define DRONE_NET_START 				"STRT"
#define DRONE_NET_LAND					"LAND"
#define DRONE_NET_HOVER					"HOVR"
#define DRONE_NET_EMERGENCY				"EMGY"
#define DRONE_NET_LENGTH				4



#define DRONE_COMMAND_HEADER			"V1CM"
#define DRONE_COMMAND_HEADER_LENGTH		4


class DroneCommand {
private:
	int specialCommand;
	float roll;
	float pitch;
	float yawSpeed;
	float vSpeed;

	float checkMinMaxOfValue(float val);
	string floatToString(float val);
	float stringToFloat(string val);

public:
	DroneCommand(float roll, float pitch, float yaw, float vertical, int specialCommand);
	DroneCommand(const DroneCommand& dc);
	DroneCommand(string command);

	virtual ~DroneCommand();

	float getPitch() const;
	void setPitch(float pitch);

	float getRoll() const;
	void setRoll(float roll);

	float getVertical() const;
	void setVertical(float vertical);

	float getYaw() const;
	void setYaw(float yawSpeed);

	int getSpecialCommand() const;
	void setSpecialCommand(int specialCommand);

	void printToConsole();

	string toString();
	void fromString(string command);

};

#endif /* DRONECOMMAND_H_ */
